import { update } from "./../modules/user";
import { ItemShops } from "./../modules/shops";
// 请求响应参数（不包含data）
export interface Result {
  code: string;
  msg: string;
}
// 定义 user 类型
export interface User {
  token: string;
}
// 请求响应参数（包含data）
export interface ResultData<T = any> extends Result {
  data: T;
}

// 分页响应参数1
export interface ResPage<T> {
  list: T[];
  pageNum: number;
  pageSize: number;
  total: number;
}
// 分页请求参数1
export interface ReqPage {
  pageNum: number;
  pageSize: number;
}
// 分页响应参数2
export interface ResPages<T> {
  records: T[];
  pageNum: number;
  pageSize: number;
  total: number;
}
// 分页请求参数2
export interface ReqPages {
  pageNum: number;
  pageSize: number;
}
// 请求后端数据类型
export interface ReqsUserParams extends ReqPages {
  username: string;
  id: number;
  age: number;
  nickName: string;
  avatar: string;
  email: string;
  address: string;
  // createTime: string[];
  role: number;
}

export interface ReqsUserList {
  username: string;
  id: number;
  age: number;
  nickName: string;
  avatar: string;
  email: string;
  address: string;
  createTime: string[];
  role: number;
}
// 文件上传模块
export namespace Upload {
  export interface ResFileUrl {
    fileUrl: string;
  }
}

// 登录模块
export namespace Login {
  export interface ReqLoginForm {
    username: string;
    password: string;
  }
  export interface ResLogin {
    [x: string]: string;
    access_token: string;
  }
  export interface ResAuthButtons {
    [key: string]: string[];
  }
}

// 用户管理模块
export namespace User {
  export interface ReqUserParams extends ReqPage {
    username: string;
    gender: number;
    idCard: string;
    email: string;
    address: string;
    createTime: string[];
    status: number;
  }
  export interface ResUserList {
    id: string;
    username: string;
    sex: string;
    role: number;
    age: number;
    gender: number;
    user: { detail: { age: number } };
    idCard: string;
    email: string;
    address: string;
    createTime: string;
    status: number;
    avatar: string;
    photo: any[];
    nickName: string;
    children?: ResUserList[];
  }
  export interface ResStatus {
    userLabel: string;
    userValue: number;
  }
  export interface ResGender {
    genderLabel: string;
    genderValue: number;
  }
  export interface ResDepartment {
    id: string;
    name: string;
    children?: ResDepartment[];
  }
  export interface ResRole {
    id: string;
    name: string;
    children?: ResDepartment[];
  }
}

export interface ChangePwdParams {
  id: number;
  oldPwd: string;
  newPwd: string;
}

//商品模块
export namespace Items {
  export interface Shops {
    id: number;
    title: string;
    sellPoint: string;
    price: number;
    stock: number;
    barcode: string;
    image: string;
    cid: number;
    status: number;
    created: string[];
    update: string[];
  }
}

export namespace Order {
  export interface OrderName {
    id: number;
    payPrice: number;
    productId: number;
    postFee: number;
    count: number;
    state: number;
    createTime: string[];
    paymentTime: string[];
    endTime: string[];
    userId: number;
    username: string;
    orderNo: string;
    orderName: string;
    orderPicture: string;
  }
}

//退款
export interface Refund {
  id: number;
  orderNo: string;
  orderPicture: string;
  refundType: number;
  refundReason: string;
  refundDesc: string;
  refundAmount: number;
  refundDate: string;
  userId: number;
  username: string;
}
